package com.wzh.project.kafka.common;
/**
 * 消息的实体类
 * @author wzh
 *
 */

import java.io.Serializable;
import java.util.Map;

import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serializer;

import com.wzh.project.utils.BinaryTransferUtils;

public class Message implements Serializable,Serializer<Object>,Deserializer<Message>{
	
	private static final long serialVersionUID = 1L;
	private String name;
	private Integer age;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getAge() {
		return age;
	}
	public void setAge(Integer age) {
		this.age = age;
	}
	@Override
	public Message deserialize(String topic, byte[] data) {
		// TODO Auto-generated method stub
		return (Message) BinaryTransferUtils.transferByteArrayToObject(data);
	}
	@Override
	public void configure(Map<String, ?> configs, boolean isKey) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public byte[] serialize(String topic, Object data) {
		// TODO Auto-generated method stub
		return BinaryTransferUtils.transferToBinaryByteArray(data);
	}
	@Override
	public void close() {
		// TODO Auto-generated method stub
		
	}
}
